#ifndef __TIMER_H__
#define __TIMER_H__

#include <Time.h>
#include <Arduino.h>
#include <WString.h>

#include "Errors.h"
#include "Commander.h"

typedef unsigned long tick_t;

enum TimeFormat {
    MIN,
    TIME,
    DATE,
    DATETIME
};

class Timer : public CommandProcessor {
private:
    error_t parceTimeToken(String const &request, char const divider, uint8_t &pos, uint8_t &value, int delta);

public:
    Timer();

    const error_t begin();


    const time_t time();

    const tick_t ticks();


    static String *toString(time_t time, uint8_t format);

public:
    virtual const bool isSupported(String const &request);

    virtual const error_t processCommand(String const &request, String &response);
};

#endif